<?php
class region_model extends CI_Model {
	public function __construct() {
		parent::__construct ();
		$this->db = $this->load->database ( 'default', true );
	}
	public function query_region_list($parent_id) {
		$parent_id = $this->db->escape_str ( $parent_id );
		$sql = "select region_id,region_name from sys_region where region_status ='1'and  parent_id ='$parent_id' order by region_id asc";
		$query = $this->db->query ( $sql );
		if ($query->num_rows () > 0) {
			return $query->result_array ();
		}
	}
	public function get_highways($region_id) {
		$parent_id = $this->db->escape_str ( $region_id );
		$sql = "select highway_id,highway_name from env_highway where  province ='$region_id' order by highway_name asc";
		$query = $this->db->query ( $sql );
		if ($query->num_rows () > 0) {
			return $query->result_array ();
		}
	}
	public function get_airports($region_id) {
		$parent_id = $this->db->escape_str ( $region_id );
		$sql = "select airport_id,airport_name from env_airport where  province ='$parent_id' order by airport_name asc";
		$query = $this->db->query ( $sql );
		if ($query->num_rows () > 0) {
			return $query->result_array ();
		}
	}
}